//
//  OMOrderInfoTableCell.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/9.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMOrderInfoTableCell.h"
#import "OMOrder.h"
@interface OMOrderInfoTableCell()
@property (nonatomic, strong) UILabel *snLabel;
@property (nonatomic, strong) UILabel *snDetailLabel;
@property (nonatomic, strong) UILabel *orderTimeLabel;
@property (nonatomic, strong) UILabel *orderTimeDetailLabel;
@property (nonatomic, strong) UILabel *paymentLabel;
@property (nonatomic, strong) UILabel *paymentDetailLabel;
@property (nonatomic, strong) UILabel *commentLabel;
@property (nonatomic, strong) UILabel *commentDetailLabel;

@end

@implementation OMOrderInfoTableCell
- (void)configureCellWithObj:(OMOrder *)order
{
    self.snDetailLabel.text = order.sn;
    self.orderTimeDetailLabel.text = order.createDate;
    self.paymentDetailLabel.text = order.paymentMethodName;
    self.commentDetailLabel.text = order.memo.length?order.memo:@"无";
}

- (void)configure
{
    [super configure];
    _snLabel = [UILabel new];
    _snLabel.font = SM_CFont(29);
    _snLabel.textColor = HEXCOLOR(@"#9F9F9F");
    _snLabel.text = @"订单编号";
    [self.contentView addSubview:_snLabel];
    [_snLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(30)));
        make.top.equalTo(@(SM_SIZE(35)));
    }];

    _orderTimeLabel = [UILabel new];
    _orderTimeLabel.font = SM_CFont(29);
    _orderTimeLabel.textColor = HEXCOLOR(@"9f9f9f");
    _orderTimeLabel.text = @"下单时间";
    [self.contentView addSubview:_orderTimeLabel];
    [_orderTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.snLabel.mas_left);
        make.top.equalTo(self.snLabel.mas_bottom).offset(SM_SIZE(20));
    }];

    _paymentLabel = [UILabel new];
    _paymentLabel.font = SM_CFont(29);
    _paymentLabel.textColor = HEXCOLOR(@"9f9f9f");
    _paymentLabel.text = @"付款方式";
    [self.contentView addSubview:_paymentLabel];
    [_paymentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.snLabel.mas_left);
        make.top.equalTo(self.orderTimeLabel.mas_bottom).offset(SM_SIZE(20));
    }];

    _commentLabel = [UILabel new];
    _commentLabel.font = SM_CFont(29);
    _commentLabel.textColor = HEXCOLOR(@"9f9f9f");
    _commentLabel.text = @"留言";
    [self.contentView addSubview:_commentLabel];
    [_commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.snLabel.mas_left);
        make.top.equalTo(self.paymentLabel.mas_bottom).offset(SM_SIZE(20));
    }];

    _snDetailLabel = [UILabel new];
    _snDetailLabel.font = SM_CFont(29)  ;
    _snDetailLabel.textColor = SM_blackColor;
    _snDetailLabel.text = @"8091 0214 077";
    [self.contentView addSubview:_snDetailLabel];
    [_snDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(200)));
        make.top.equalTo(self.snLabel.mas_top);
    }];

    _orderTimeDetailLabel = [UILabel new];
    _orderTimeDetailLabel.font = SM_CFont(29)  ;
    _orderTimeDetailLabel.textColor = SM_blackColor;
    _orderTimeDetailLabel.text = @"2017-04-20 14：33：33";
    [self.contentView addSubview:_orderTimeDetailLabel];
    [_orderTimeDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.snDetailLabel.mas_left);
        make.top.equalTo(self.orderTimeLabel.mas_top);
    }];

    _paymentDetailLabel = [UILabel new];
    _paymentDetailLabel.font = SM_CFont(29)  ;
    _paymentDetailLabel.textColor = SM_blackColor;
    _paymentDetailLabel.text = @"在线支付 - 支付宝支付";
    [self.contentView addSubview:_paymentDetailLabel];
    [_paymentDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.snDetailLabel.mas_left);
        make.top.equalTo(self.paymentLabel.mas_top);
    }];

    _commentDetailLabel = [UILabel new];
    _commentDetailLabel.font = SM_CFont(29)  ;
    _commentDetailLabel.textColor = SM_blackColor;
    _commentDetailLabel.text = @"无";
    [self.contentView addSubview:_commentDetailLabel];
    [_commentDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.snDetailLabel.mas_left);
        make.top.equalTo(self.commentLabel.mas_top);
    }];
}


+ (CGFloat)cellHeight
{
    return SM_SIZE(280);
}

@end
